Skip to content

Fix Baidu search verification failures and hangs#1006

Merged
PeterDaveHello merged 1 commit into
ChatGPTBox-dev:masterfrom
PeterDaveHello:fix-verify-config-baidu-check
Jul 16, 2026
Merged

Fix Baidu search verification failures and hangs#1006
PeterDaveHello merged 1 commit into
ChatGPTBox-dev:masterfrom
PeterDaveHello:fix-verify-config-baidu-check

Conversation

@PeterDaveHello

@PeterDaveHello PeterDaveHello commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

  • keep the established node-fetch path for Bing, Yahoo, and Naver, while using Node built-in fetch for Baidu to avoid the reproducible connection resets and hangs
  • use plain-object headers accepted by both fetch implementations without coupling built-in fetch to node-fetch header objects
  • bound each live request to 30 seconds and the workflow job to 5 minutes
  • require HTTP 200 responses and report the phase, site, URL, and underlying network error code
  • distinguish Baidu redirects to verification pages from selector regressions without rejecting Naver mobile redirects

Validation

  • npm run pretty
  • npm run lint
  • npm test (704 passed)
  • npm run build
  • npm run verify (Bing, Yahoo, Baidu, and Naver desktop/mobile checks passed)
  • node --check .github/workflows/scripts/verify-search-engine-configs.mjs
  • git diff --check origin/master..HEAD
  • GitHub PR tests, CodeRabbit, and Kilo checks passed
  • Copilot reviewed the final head and generated no new comments
  • all review threads are resolved

Validation skipped: manual browser smoke tests; this change only affects the CI verifier and workflow, not extension runtime behavior.

GitHub-hosted verify-configs execution remains unverified because Actions are disabled on the fork; queued fork runs are not treated as evidence.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation in AGENTS.md to move Baidu from the default verification checks to the optional engines list, as it may be blocked by regional or anti-bot measures. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Disable Baidu live URL in config verifier to avoid flaky CI hangs

🐞 Bug fix 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Skip Baidu live fetch in the scheduled config verification to prevent CI timeouts.
• Keep Baidu selectors/adapters intact while preserving live coverage for other engines.
• Update verifier documentation to match the enabled default checks.
Diagram

graph TD
  A["Scheduled/Manual verify job"] --> B["verify-search-engine-configs.mjs"] --> C{"URL list"}
  C --> D["Fetch HTML"] --> E["Site adapters"] --> F["Pass/Fail report"]
  C --> G["Baidu URL disabled"]
  subgraph Legend
    direction LR
    _job["CI job"] ~~~ _script["Verifier script"] ~~~ _decision{"Config"}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Skip Baidu only on GitHub-hosted runners
  • ➕ Preserves Baidu live coverage for local/self-hosted environments
  • ➕ Keeps scheduled CI stable without permanently removing coverage everywhere
  • ➖ Adds environment detection/branching logic
  • ➖ Still leaves the main CI signal without Baidu coverage (where it matters most)
2. Add strict per-request timeouts + abort/retry
  • ➕ Could keep Baidu enabled while preventing 6-hour hangs
  • ➕ General hardening for other engines if they become flaky
  • ➖ Doesn't address frequent connection resets; could still be noisy red
  • ➖ More moving parts (timeouts/backoff) to tune and maintain

Recommendation: The PR’s approach (removing Baidu from default live URLs while keeping its selector/adapter configuration) is the best near-term fix because it restores CI reliability with minimal change surface. If Baidu live coverage is still desired, consider re-enabling it conditionally (e.g., non-GitHub runners) plus adding request timeouts to prevent long hangs.

Files changed (2) +8 / -5

Bug fix (1) +5 / -2
verify-search-engine-configs.mjsDisable Baidu live verification URL to prevent flaky CI fetches +5/-2

Disable Baidu live verification URL to prevent flaky CI fetches

• Removes the Baidu search URL from the default live URL set by commenting it out and documenting the GitHub Actions connectivity issues. Keeps the rest of the engine URL configuration intact and slightly generalizes the Accept-Language comment.

.github/workflows/scripts/verify-search-engine-configs.mjs

Documentation (1) +3 / -3
AGENTS.mdAlign verifier docs with default engines (remove Baidu from defaults) +3/-3

Align verifier docs with default engines (remove Baidu from defaults)

• Updates the 'npm run verify' documentation to reflect that default checks target Bing, Yahoo, and Naver (no Baidu). Moves Baidu into the optional engines list and updates the default URL examples accordingly.

AGENTS.md

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The search verification script now uses site-specific fetch implementations, request timeouts, same-origin redirect checks for Baidu, non-200 response rejection, and coded error reporting. The GitHub Actions verification job has a five-minute execution limit.

Changes

Search verification

Layer / File(s) Summary
Request validation and execution limits
.github/workflows/scripts/verify-search-engine-configs.mjs, .github/workflows/verify-configs.yml
The verifier selects fetch implementations, applies request timeouts, validates Baidu redirect origins and HTTP status, includes optional error codes, and runs under a five-minute job limit.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VerifyConfigs
  participant Verifier
  participant SearchEngine
  VerifyConfigs->>Verifier: Start verification job
  Verifier->>SearchEngine: Fetch page with timeout
  SearchEngine-->>Verifier: Return redirect or HTTP response
  Verifier->>Verifier: Validate origin, status, and response text
  Verifier-->>VerifyConfigs: Report result and error code
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: addressing Baidu verification failures and hangs in CI.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the AGENTS.md documentation to move Baidu from the default verification checks list to the optional engines list, as it may be blocked by regional or anti-bot measures. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@kilo-code-bot

kilo-code-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • .github/workflows/scripts/verify-search-engine-configs.mjs
  • .github/workflows/verify-configs.yml
Reconciled Prior Findings (incremental)
  • Baidu coverage removed (file-level, prior state): no longer applicable — HEAD keeps Baidu live via globalThis.fetch.
  • Mixed Headers instances (line 150, Copilot): resolved — desktopHeaders is now a plain object and the node-fetch Headers import was removed.
  • Skip Baidu rather than switch fetchers (line 148, codex): author provided justification; Baidu live coverage intentionally retained.
Previous Review Summaries (2 snapshots, latest commit 9129b17)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 9129b17)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • .github/workflows/scripts/verify-search-engine-configs.mjs
  • .github/workflows/verify-configs.yml

Previous review (commit 7fbd1df)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • .github/workflows/scripts/verify-search-engine-configs.mjs
  • AGENTS.md

Reviewed by hy3:free · Input: 29.2K · Output: 4K · Cached: 233.6K

@qodo-code-review

qodo-code-review Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Baidu coverage silently removed ✓ Resolved 🐞 Bug ☼ Reliability
Description
Baidu is no longer verified because its URL list is now empty, and the verifier treats an empty list
as success (no fetches, no selector assertions, no skip notice). Since Baidu remains a runtime site
adapter, selector/parser regressions for Baidu can now land without any verification signal.
Code

.github/workflows/scripts/verify-search-engine-configs.mjs[R100-103]

+  baidu: [
+    /*'https://www.baidu.com/s?wd=hello'*/
+    // GitHub Actions requests are reset or left hanging
+  ],
Evidence
The verifier only validates selectors inside urlArray.map(...), so an empty baidu URL array
results in zero fetches/DOM parses for Baidu and no failures being recorded; meanwhile Baidu is
still configured and initialized as a runtime adapter.

.github/workflows/scripts/verify-search-engine-configs.mjs[90-114]
.github/workflows/scripts/verify-search-engine-configs.mjs[146-185]
src/content-script/site-adapters/index.mjs[32-80]
src/content-script/site-adapters/baidu/index.mjs[1-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The verifier currently skips Baidu implicitly by using an empty URL array, which removes verification coverage without reporting that Baidu was skipped.

## Issue Context
Baidu is still present in the shared `config` and is mounted by the runtime site adapter, so losing verification coverage can allow regressions to ship undetected.

## Fix Focus Areas
- .github/workflows/scripts/verify-search-engine-configs.mjs[90-114]
- .github/workflows/scripts/verify-search-engine-configs.mjs[146-185]

## Suggested fix
- Add an explicit skip mechanism (e.g., `SKIP_ENGINES=baidu` or default-skip Baidu when `process.env.GITHUB_ACTIONS` is set) rather than relying on an empty array.
- Log skipped engines (e.g., `console.log('Skipping baidu: disabled in CI')`) so the verifier output reflects reduced coverage.
- Optionally add a fixture-based Baidu check (parse a stored HTML snapshot with JSDOM) so selectors are still validated without making network calls.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread .github/workflows/scripts/verify-search-engine-configs.mjs Outdated
@PeterDaveHello
PeterDaveHello force-pushed the fix-verify-config-baidu-check branch from 7fbd1df to 9129b17 Compare July 16, 2026 14:32
@PeterDaveHello PeterDaveHello changed the title Skip unreliable Baidu search verification Restore reliable Baidu search verification Jul 16, 2026
@PeterDaveHello
PeterDaveHello requested a review from Copilot July 16, 2026 14:33
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9129b17b25

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/scripts/verify-search-engine-configs.mjs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the reliability and diagnosability of the CI search-engine configuration verifier by mixing HTTP clients per site (to avoid known connectivity issues), adding per-request timeouts, and tightening failure reporting, while also bounding the overall workflow runtime.

Changes:

  • Add a 5-minute timeout to the verify-configs workflow job.
  • Use Node’s built-in fetch specifically for Baidu requests while keeping node-fetch for other engines.
  • Add a 30-second per-request timeout, enforce HTTP 200 responses, and improve error/redirect reporting.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/verify-configs.yml Adds job timeout to prevent the scheduled verifier from hanging indefinitely.
.github/workflows/scripts/verify-search-engine-configs.mjs Introduces mixed fetch strategy (Baidu via built-in fetch), per-request timeouts, and improved HTTP/redirect/error reporting for verification runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/scripts/verify-search-engine-configs.mjs
Keep node-fetch for search engines that reject Node's global fetch, but
use the global fetch implementation for Baidu, where node-fetch
connections reset or hang.

Bound each request and the workflow job, require HTTP 200 responses, and
include the site and URL in errors. This restores Baidu coverage without
allowing a live probe to consume the six-hour default.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@PeterDaveHello PeterDaveHello changed the title Restore reliable Baidu search verification Restore Baidu search verification with bounded requests Jul 16, 2026
@PeterDaveHello PeterDaveHello changed the title Restore Baidu search verification with bounded requests Fix Baidu search verification failures and hangs Jul 16, 2026
@PeterDaveHello
PeterDaveHello merged commit cac511d into ChatGPTBox-dev:master Jul 16, 2026
4 checks passed
@PeterDaveHello
PeterDaveHello deleted the fix-verify-config-baidu-check branch July 16, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants